﻿using System.Threading.Tasks;
using CkSoftware.GroupMe.Sdk.Core.Interfaces;

namespace CkSoftware.GroupMe.Sdk.Core
{
	/// <summary>
	/// Basic WebApi Access.
	/// </summary>
	public interface IWebApiAccess
	{
		/// <summary>
		/// Parameter name to override if non-standard token url parameter is required.
		/// </summary>
		string AccessTokenParameter { get; set; }

		/// <summary>
		/// Executes the given command asynchronousely and returns an awaitable task containing the expected result.
		/// </summary>
		/// <typeparam name="TResultEntity">Result entity which will be deserialized from the WebApi / REST service.</typeparam>
		/// <param name="command">The command to execute.</param>
		/// <returns>Awaitable task returning the given result entity.</returns>
		Task<TResultEntity> ExecuteCommand<TResultEntity>(IWebApiCommand<TResultEntity> command)
			where TResultEntity : IWebApiResult, new();
	}
}